<#assign base = request.contextPath />
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <base id="base" href="${base}">
    <title>Add Account</title>
</head>
<body>
<div class="container">
    <div class="panel panel-default">
        <div class="panel-heading text-center">
            <h1>Account Edit</h1>
        </div>
        <div class="panel-body">
            <form class="form-horizontal" id="form" action="/account/add" method="post" role="form">
                <div class="form-group">
                    <label for="ac_code" class="col-sm-2 control-label">Code</label>
                    <div class="col-sm-10">
                        <input type="number"  class="form-control" id="ac_code" name="ac_code" placeholder="Code"  ">
                    </div>
                </div>
                <div class="form-group">
                    <label for="ac_name" class="col-sm-2 control-label">Name</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="ac_name" name="ac_name" placeholder="Name" >
                    </div>
                </div>
                <div class="form-group">
                    <label for="ac_remark" class="col-sm-2 control-label">Remark</label>
                    <div class="col-sm-10">
                        <textarea  class="form-control" id="ac_remark" name="ac_remark" placeholder="Remark"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label for="ac_state" class="col-sm-2 control-label">State</label>
                    <div class="col-sm-10">
                        <label class="radio-inline">
                            <input type="radio" name="ac_state" id="ac_state" value="1"> 在线
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="ac_state" id="ac_state" value="2"> 离线
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="ac_state" id="ac_state" value="3"> 封停
                        </label>
                    </div>
                </div>

                <div class="form-group">
                    <label for="ac_type" class="col-sm-2 control-label">Type</label>
                    <div class="col-sm-10">
                        <select class="btn btn-default dropdown-toggle" name="ac_type">
                            <optgroup label="角色管理">
                                <option value="1" name="ac_type">用户</option>
                                <option value="2" name="ac_type">游客</option>
                            </optgroup>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-default">Submit</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<link href="${base}/css/select2.min.css" rel="stylesheet" />
<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="${base}/js/select2.min.js"></script>
<script src="${base}/js/i18n/zh-CN.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $(".btn btn-default dropdown-toggle").select2();
    });
    $('#form').submit(function(){
        var folder= $("#ac_code").val();
        var folder2= $("#ac_name").val();
        var folder3= $("#ac_remark").val();
        var folder4= document.getElementsByName("ac_state");

        if($.trim(folder)==""){
            alert("please input Code!");
            return false;
        }
        if($.trim(folder2)==""){
            alert("please input Name!");
            return false;
        }
        var j=0;

        for(var i=0;i<folder4.length;i++){
            if(folder4[i].checked==false){
                j++;
//                alert(j)
            }
        }
        if(j==3){
            alert("please select State!");
            return false;
        }

    });
</script>
</html>